package main

import (
	"fmt"
	//"log"
	"GoHTTP/01httpBase/100selfRouter/route"
	"net/http"
)

func GetHello(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "Hello Get!")
}
func NotFoundFunc(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "404错误")
}

func main() {
	fmt.Println("你好")
	r := route.New("static", NotFoundFunc)
	r.AddRoute("GET", "/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprint(w, "Hello Get!")
	})

	//r.AddRoute("GET", "/", GetHello)
	/*r.HandleFunc("POST", "/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprint(w, "hello POST!")
	})
	*/
	r.Listen(":8080") //http.ListenAndServe(":8080", r)

}
